Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] feat: add share button for flow links #3483

Closed
wants to merge 51 commits into from
Closed

Conversation

RODO94
Copy link
Contributor

@RODO94 RODO94 commented Jul 31, 2024

What does this PR do?

This PR comes from the Trello ticker: https://trello.com/c/k8cQojk7/2958-share-service-link-in-editor

The intention is to add a share link or copy link button to the FlowEditor page for users to easily see and share the right links for their flows.

From the Trello ticket:

As an Editor
I want to be able to copy/paste my service URL (with custom subdomain)
so that I can share the link

I worked through the Figma designs given here: Figma mock-ups

There has been a range of components added, created, and altered. From the new styled buttons, CopyButton and ToggleButton.

The reuse of the ImageWrapper component used previously in Design Settings but customised to new sizes, I thought keeping the name consistent would point at similar use but different settings, since neither are exported from their origin.

A LinkComponent was made (naming may change to be more explicit) to harmonise styling across all the different links in the Dialog box, this includes the ability to add either an icon or image or neither to the Title of a link.

The ToggleButton component was used to move the sidebar toggle from the top header to the Sidebar, in line with the other buttons for publishing and sharing links. This has been positioned absolute with a position relative set around the box containing the buttons so it can hang over the left edge of the siderbar.

Feedback requests:

Feel free to give me feedback on anything, but these are the particular areas I found many options in.

  1. Structure and use of <LinkComponent
  2. The way I have used MUI components and styled them
  3. Closeness to the initial brief

To Do's

  • Remove icon buttons from top of sidebar and replace with buttons
  • Create new dialog for seeing links
  • Make Published link opaque if the flow has not been published
  • Add previous buttons for refresh and console
  • Create tests for new component

@RODO94
Copy link
Contributor Author

RODO94 commented Jul 31, 2024

Copy link

github-actions bot commented Jul 31, 2024

Removed vultr server and associated DNS entries

@RODO94 RODO94 force-pushed the rory/shareable-flow-url branch from 3fc6375 to 4317017 Compare August 5, 2024 12:13
@RODO94 RODO94 force-pushed the rory/shareable-flow-url branch from 3e9295c to 68760d9 Compare August 6, 2024 09:27
@RODO94
Copy link
Contributor Author

RODO94 commented Aug 6, 2024

Using Buckinghamshire as a team is good for testing the Subdomain flow, I updated the Hasura with a close to real dummy data.

@RODO94 RODO94 requested a review from a team August 6, 2024 16:06
Copy link
Member

@jessicamcinchak jessicamcinchak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took a quick first pass at this! Looking like a really solid start, but finding some of the styling and conditional syntax used throughout to be a bit confusing - let's talk through any initial feedback points / questions if they aren't clear!

Best tip I can offer is "do less" / try to reference more from our already existing MUI global theme ! Personally I think our MUI theme & existing style patterns should be your source of truth here, and Figma as a visual guide only (we almost never use Figmas to pixel exactness).

@@ -24,6 +24,8 @@ const Flow = ({ breadcrumbs = [] }: any) => {
href: `${window.location.pathname.split(id)[0]}${id}`,
}));

console.log(useStore.getState().flowStatus);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops lingering console.log, please remove!

backgroundColor:
isOutsideEditor || environment === "standalone"
? theme.primaryColour
: "#2c2c2c",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I'm following the introduction of isOutsideEditor and why this new backgroundColor condition is necessary?

state.previewEnvironment does semi-confusingly return "editor" rather than "standalone" for /draft & /preview routes - but I think we'd want to update this directly rather than introduce a new variable?

Also, broadly, how does changing the header color related to sharing links?


const PaddedText = styled(Typography)(({ theme }) => ({
paddingLeft: "31px",
}));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: in my opinion, defining a styled component is overkill if there's just a few configs - I personally think the inline sx prop is cleaner in these cases, eg:

<Typography sx={{ paddingLeft: "31px" }}>
  {...}
</Typograhy>

return (
<Tooltip title={copyMessage}>
<Button
component={"button"}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: is component={"button"} redundant here?

: props.isFlowPublished && flowStatus !== "online"
? publishedOfflineDescription
: publishedOnlineDescription
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: anytime a ternary is more than a single condition, I think it's helpful for readability to extract into an external helper function that can use more verbose if/else or switch syntax?

Eg description={getLinkDescription(isPublished, status)}

This also has benefit of becoming something we can test indepedently!


const SecondaryButton = styled(IconButton)(({ theme }) => ({
color: theme.palette.common.black,
}));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: MUI's IconButton accepts a color prop which we can use to reference our standard "secondary" color per the global theme - would that be more appropriate here?

Personally find it quite confusing to be defining bespoke "secondary" styles and straying from global theme.

padding={"0px 20px"}
gap={"8px"}
>
<SecondaryButton color="primary">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find <SecondaryButton color="primary"> very semantically confusing!! See related comment above.

flexDirection: "row",
gap: "8px",
borderRadius: "5px",
padding: "8px",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Feels a bit surprising & brittle to me to see properties like display, flexDirection, and gap defined directly on a Button - I think I'd expect to see a wrapper Box/div with these properties that then accepts buttons as children ??

<ActivePublishedLink title="PlanX link" link={props.link} />
) : (
<InactivePublishedLink title="PlanX link" message={props.link} />
)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this ternary very difficult to read, and similar to another comment would much prefer more verbose if/else or switch syntax here to describe the expected conditional rendering rules.

Also a great example where tests would help describe expected behavior here !

isPublished={props.isPublished}
/>
) : (
<Link pl={"31px"} href={props.link}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: noticing lots of places throughout these file changes where 31px is hard-coded - it'd be much more ideal to try to use an existing global theme.spacing value here I think ?

@RODO94
Copy link
Contributor Author

RODO94 commented Aug 15, 2024

Closed Branch

Branch has been closed as the design has progressed away from this iteration.

It may be picked up later in time, so the branch will stay, but the PR will remain closed.

A new branch and PR will be made for the new iteration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants